package com.whkjdx.examtool;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.oas.annotations.EnableOpenApi;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@EnableFeignClients
@SpringBootApplication
@EnableOpenApi
@EnableScheduling
public class ExamtoolApplication {

	public static void main(String[] args) {
		SpringApplication.run(ExamtoolApplication.class, args);
	}


	@Bean
	public Docket frontApi() {
		return new Docket(DocumentationType.OAS_30)
				//是否开启，根据环境配置
				.enable(true)
				.apiInfo(frontApiInfo())
				.select()
				//指定扫描的包
				.apis(RequestHandlerSelectors.any())
				.paths(PathSelectors.any())
				.build();
	}

	/**
	 * 前台API信息
	 */
	private ApiInfo frontApiInfo() {
		return new ApiInfoBuilder()
				.title("武科大考试工具")
				.description("武科大考试工具")
				.version("1.0")
				.build();
	}
}
